package ds.factcom.view.console;

import java.util.Observable;
import java.util.Observer;
import java.util.Scanner;

import ds.factcom.domain.client.DocumentType;
/**
 * 
 * @author Javier De Luca, Maximiliano Herrera, Matias Samblancat
 *
 */
public class BaseConsoleView implements Observer {

	private final Scanner scanner = new Scanner(System.in);
	
	@Override
	public void update(Observable observable, Object object) {
		if (observable != null){
			if((object instanceof String) && (object != null)){
				showMessage(((String)object));
			}
		}
	}
	
	protected void showMessage(String string) {
		System.out.println(string);
		System.out.println("-------------------------------------------------------");
	}
	
	protected void showErrorMessage(String message){
		System.out.println(message);
	}
	
	protected String getMessageDocumentType(){
		String message ="(";
		for (int i = 0; i < DocumentType.values().length; i++) {
			message+= DocumentType.values()[i].getValue();
			if(i < DocumentType.values().length-1){
				message+="/";
			}
		}
		message+=")";
		return message;
	}

	protected Scanner getScanner() {
		return scanner;
	}

}
